{extend name="$base_mall" /}
{block name="resources"}
<link rel="stylesheet" type="text/css" href="WAP_CSS/member_balance.css">
{/block}
{block name="main"}
{php}
$member_account = api("System.Member.memberAccount");
$member_account = $member_account['data'];
$sum =  $member_account['credit'];

// 提现设置
$withdraw_config = api("System.Config.balanceWithdraw");
$withdraw_config = $withdraw_config['data'];
{/php}
<div class="member-balance">
	<div id="mescroll" class="mescroll" style="top: 44px;">
		<div class="account-box ns-border-color">
			<p class="balance">{$sum}</p>
			<p class="style">{:lang('member_credit')}</p>
			<a   href="{:__URL('MALL_MAIN/member/creditTransfer')}" class="account-title ns-border-color ns-bg-color">{:lang('transfer')}</a>
			<a   href="{:__URL('MALL_MAIN/member/exchange')}" class="account-title ns-border-color ns-bg-color">兑换{:lang('member_coin')}</a>
		</div>
		<ul class="list-content">
		</ul>
	</div>
</div>
{/block}
{block name="footer"}{/block}

{block name="script"}
<script type="text/javascript">
	$(function(){
		mescroll = new ScrollList("mescroll", query_detail);
	});

	function query_detail(page_index, is_append)
	{
		var params = {page_index: page_index,account_type:8};
		var html = "";
		api("System.Member.accountRecordsList", params, function (res) {
			console.log(res)
			var list = res.data;
			if (list.data.length > 0) {
				$(list.data).each(function (i, v) {
					html += '<div class="list-content-wrapper">';
					html += '<div class="list-content-wrapper-top">';
					html += '<div class="list-content-wrapper-top-left text16">' + v.type_name + '</div>';
					html += '<div class="list-content-wrapper-top-right ns-text-color" >' + v.number + '</div>';
					html += '</div>';
					html += '<div class="list-content-wrapper-bottom">';
					html += '<div class="list-content-wrapper-bottom-left ns-text-color-gray">' + v.text + '</div>';
					html += '<div class="list-content-wrapper-bottom-right ns-text-color-gray">' + timeStampTurnTime(v.create_time) + '</div>';
					html += '</div>';
					html += '</div>';
					html += '<div class="line"></div>';
				});
			} else {
				html += '<div class="list-empty-wrapper">';
				html += '<div>';
					html += '<div class="list-empty-img">';
						html += '<img src="' + WAPIMG + '/wap_nodata.png">';
					html += '</div>';
					html += '<div class="list-empty-text">';
						html += '暂无数据';
					html += '</div>';
				html += '</div>';
				html += '</div>';
			}

			if (is_append) $("#mescroll ul").append(html);
			else $("#mescroll ul").html(html);
			mescroll.endByPage(list.total_count, list.page_count);
		});
	}
</script>
{/block}